import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n
import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

import UploadExcel from '@/components/upload'
Vue.component('UploadExcel', UploadExcel)

// 全屏
import ScreenFull from '@/components/screenfull'
Vue.component('ScreenFull', ScreenFull)

// 主题颜色
import ThemePicker from '@/components/themePicker'
Vue.component('ThemePicker', ThemePicker)

// 多语言
import Language from '@/components/lang/index.vue'
Vue.component('Language', Language)

import i18n from '@/components/lang'

// 多页签
import tagsView from '@/components/TagsView'
Vue.component('tagsView', tagsView)

// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
})

// 过滤器
import * as obj from '@/filters'
for (const key in obj) {
  Vue.filter(key, obj[key])
}

Vue.config.productionTip = false

// 自定义指令处理图片
import { imgerr } from '@/directives'
Vue.directive('imgErr', imgerr)

// 混入
import { checkIsPermission } from '@/mixin'
Vue.mixin(checkIsPermission)

new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
